<?php

require_once ("Utils.php");

require_once ("./app/yop/YopOrder.php");
require_once ("Rsa.php");

$sourceData = file_get_contents("php://input");
// 使用私钥解密
$decryptData = Rsa::privateDecrypt($sourceData);

$data = json_decode($decryptData, true);
if($data['type'] == 'Yop') {
    $YopOrder = new YopOrder();
    $retData = $YopOrder->reqYopData($data);
}
// 使用私钥加密
$encryptData = Rsa::privateEncrypt($retData);
echo $encryptData;